package com.ttg.web.dao.Impl;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ttg.common.entities.BasePage;
import com.ttg.common.enums.TagDataSourceEnum;
import com.ttg.model.dto.PeopleInfoGetListDto;
import com.ttg.model.mapper.PeopleInfoMapper;
import com.ttg.model.pojo.PeopleInfo;

import com.ttg.model.vo.PeopleInfoGetListVo;
import com.ttg.web.dao.PeopleInfoDao;
import org.springframework.stereotype.Service;


import java.util.List;

@Service
public class PeopleInfoDaoImpl extends ServiceImpl<PeopleInfoMapper, PeopleInfo> implements PeopleInfoDao {

    @Override
    public BasePage<PeopleInfoGetListVo> getList(PeopleInfoGetListDto dto) {
        return baseMapper.getList(dto.parse(),dto);
    }

    @Override
    public List<PeopleInfo> getAllByTypeAndStatus(TagDataSourceEnum type) {
        LambdaQueryWrapper<PeopleInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.eq(PeopleInfo::getPepDataSource,type.getValue());
        lambdaQueryWrapper.eq(PeopleInfo::getPepStatus,0);
        lambdaQueryWrapper.eq(PeopleInfo::getUpdateType,"auto");
        return list(lambdaQueryWrapper);
    }
}
